<?php defined('IN_SITE') or die('Access Denied');?>
<div class="page-header">
	<h1>单品管理</h1>
</div>
<form id="form_search" name="form_search" method="post" action="">
	<div class="operate panel panel-default">
		<div class="panel-body">
			<div class="pull-left" id="main-sub-menu">
				<?php include $mainSubMenu;?>
			</div>
			<div class="pull-right">
				<a onclick="save();"  class="btn btn-sm btn-primary">保存</a>
			</div>
		</div>
	</div>
</form>
<!-- 功能操作区域结束 -->
<!-- 列表显示区域  -->
<div class="row">
	<div class="col-sm-4 sub_left_menu">
		<div class="well">
			<ul class="tree_menu"></ul>
		</div>
	</div>
	<div class="col-sm-8 sub_content">
		<form action="<?php echo C('backend');?>index.php?com=items&c=index&m=add" id="form_data" name="form_data" method="post" class="well form-horizontal clearfix">
			<input type="hidden" name="ajax" id="ajax" value="1">
			<input type="hidden" name="opmode" id="opmode" value="">
			<input type="hidden" name="dosubmit" value="1" />
			<input type="hidden" name="id" value="<?php echo $id;?>" />
			<input type="hidden" name="__token__" value="<?php echo $token;?>" />

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="cid">分类*：</label>
				<div class="col-sm-8">
				<select name="cid" id="cid" class="form-control">
					<?php foreach($categories as $list):?>
					<option value="<?php echo $list['id']?>" <?php if($link['cid'] == $list['id']):?>selected="selected"<?php endif;?> >
					<?php echo  ($list['parent_id'] > 0 ? "&nbsp;&nbsp;&nbsp;&nbsp;" : "") . $list['name'];?>
					</option>
					<?php endforeach;?>
				</select>
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="name">商品名称*：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" id="name" name="name" check="require" msg="请输入商品名称" value="<?php echo $item['name'];?>" />
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="price">商品单价*：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" check="require" msg="请输入商品单价" name="price" id="price" value="<?php echo $item['price'];?>" />
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="url">单品链接*：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" check="require" msg="请输入单品链接" name="url" id="url" value="<?php echo $item['url'];?>" />
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="image">图片链接*：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" check="require" msg="请输入图片链接" name="image" id="image" value="<?php echo $item['image'];?>" >
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="sort">排序：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" id="sort" name="sort" >
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="status">状态*：</label>
				<div class="col-sm-8">
					<select name="status" id="status" class="form-control">
						<option value="1">启用</option>
						<option value="0">禁用</option>
					</select>
				</div>
			</div>

			<div class="form-group col-xs-12">
				<label class="col-sm-4 control-label" for="description" >简介：</label>
				<div class="col-sm-8" >
					<textarea class="form-control" name="description" id="description" rows="5" class="col-xs-12" ><?php echo $item['description'];?></textarea>
				</div>
			</div>
		</form>
	</div>
</div>